package com.alibaba.ai.dao;

import com.alibaba.ai.entity.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by admin on 2020/5/28.
 */
@Mapper
@Repository
public interface zHousingMapper {


    //查找房源信息
    @Select("select * from Z_HOUSING")
    List<zHousing> zHousingList();


    //根据图片外键查图片
    @Select("select * from Z_IMAGE where ID = #{id}")
    zImage zImage(@Param("id") int id);


    //根据租金外键查租金
    @Select("select * from Z_MONEY where ID = #{i}")
    zMoney zMoney(@Param("i") int i);


    //根据id查房源信息
    @Select("select * from Z_HOUSING where Z_ID = #{id}")
    zHousing getzHousingBy(@Param("id") int id);


    //根据房源信息中地址外键查询地址信息
    @Select("select * from Z_SITE where ID = #{i}")
    zSite getzSites(@Param("i") int i);


    //根据房源信息中的楼层外键查询楼层信息
    @Select("select * from Z_STOREY where ID = #{i}")
    zStorey getzStoreys(@Param("i") int i);


    //根据房源信息中的楼栋号外键查询楼栋号
    @Select("select * from Z_MARK where ID = #{i}")
    zMark getzMarks(@Param("i") int i);


    //根据房源信息中的租金外键查询租金
    @Select("select * from Z_MONEY where ID = #{i}")
    zMoney getzMoneys(@Param("i") int i);


    //根据房源信息中的图片外键查询图片
    @Select("select * from Z_IMAGE where ID = #{i}")
    zImage getzImages(@Param("i") int i);


    //根据公交车号，查询房源
    @Select("select * from Z_HOUSING where Z_TRAFFIC like #{ins}")
    List<zHousing> zHousingGJ(@Param("ins") String ins);


    //根据 区域 找房
    @Select("select * from Z_SITE where Z_AREA like #{zArea}")
    List<zSite> zSites(@Param("zArea") String zArea);


    //根据 区域id 查房源id
    @Select("select * from Z_HOUSING where Z_SITE_ID = #{id}")
    List<zHousing> zSHousingSite(@Param("id") int id);


    //根据 租金id 查房源id
    @Select("select * from Z_HOUSING where Z_MONEY_ID = #{id}")
    List<zHousing> zHousingMoneyS(@Param("id") int id);


    //个人房源 类型为 住宅
    @Select("select * from Z_HOUSING where Z_TYPE= '住宅'")
    List<zHousing> getzHousingGR();


    //房源装修程度为精装修和豪华装修
    @Select("select * from Z_HOUSING where Z_LEVEL = '精装修'or Z_LEVEL = '豪华装修' ")
    List<zHousing> getzHousingJX();


    //根据 居室 查房源
    @Select("select * from Z_HOUSING where Z_HOUSE like #{ins} ")
    List<zHousing> getzHousingHX(String ins);


    //根据 方式（合租） 查房源
    @Select("select * from Z_HOUSING where Z_MODE = #{z_mode}")
    List<zHousing> getzHOUsingFS(@Param("z_mode") String z_mode);


    //根据朝向查id
    @Select("select * from Z_HOUSING where Z_TOWARDS = #{z_towards}")
    List<zHousing> getzHCX(@Param("z_towards") String z_towards);


    //根据地铁线路查id
    @Select("select * from Z_SITE where Z_SUBWAY = #{z_subway}")
    List<zSite> getzSitesList(@Param("z_subway") String z_subway);


    //根据地铁站查询
    @Select("select * from Z_SITE where Z_STATION = #{z_station}")
    List<zSite> getzSitesLists(@Param("z_station") String z_station);


    //根据租金查询租金id
    @Select("select *from Z_MONEY where Z_RENT >= #{zRent1} and Z_RENT <= #{zRent2} ")
    List<zMoney> zhousingMoney(@Param("zRent1") int zRent1, @Param("zRent2") int zRent2);


    //根据距离区间查询房源
    @Select("select * from Z_SITE where Z_DISTANCE >= #{distance1} and Z_DISTANCE <= #{distance2}")
    List<zSite> getzSitesListd(@Param("distance1") int distance1, @Param("distance2") int distance2);


    //根据区域模糊查询。
    @Select("select * from Z_SITE where Z_AREA like #{ins}")
    List<zSite> getzSitesListsa(@Param("ins") String ins);


    //根据  小区名 查房源
    @Select("select * from Z_HOUSING where Z_ILLAGE like #{ins}")
    List<zHousing> zHousingsill(@Param("ins") String ins);
}
